angular.module('wanhang.services', [])

/**
 * A simple example service that returns some data.
 */

.factory('Resumes', function($resource, CSRF_TOKEN) {
  return $resource('/api/resumes/:resumeId', {
    '_token': CSRF_TOKEN
  }, {
    query: {
      method: 'GET',
      isArray: true
    },
    save: {
      method: 'POST'
    },
    remove: {
      method: 'DELETE'
    }
  })
})
  .factory('Categories', function($resource, CSRF_TOKEN) {
    return $resource('/api/categories/:categoryId', {
      '_token': CSRF_TOKEN
    }, {
      query: {
        method: 'GET',
        isArray: true
      },
      save: {
        method: 'POST'
      },
      remove: {
        method: 'DELETE'
      }
    })
  })
  .factory('Jobs', function($resource, CSRF_TOKEN) {
    return $resource('/api/jobs/:jobId', {
      '_token': CSRF_TOKEN
    }, {
      query: {
        method: 'GET',
        isArray: false
      },
      save: {
        method: 'POST'
      },
      remove: {
        method: 'DELETE'
      }
    })
  })
    .factory('News', function($resource, CSRF_TOKEN) {
        return $resource('/api/news/:newsId', {
            '_token': CSRF_TOKEN
        }, {
            query: {
                method: 'GET',
                isArray: false
            },
            save: {
                method: 'POST'
            },
            remove: {
                method: 'DELETE'
            }
        })
    })
    .factory('Products', function($resource, CSRF_TOKEN) {
        return $resource('/api/products/:productId', {
            '_token': CSRF_TOKEN
        }, {
            query: {
                method: 'GET',
                isArray: false
            },
            save: {
                method: 'POST'
            },
            remove: {
                method: 'DELETE'
            }
        })
    })
    .filter('unsafe', ['$sce', function ($sce) {
        return function (val) {
            return $sce.trustAsHtml(val);
        };
    }]);;